package pl.edu.agh.gronoMining.resultAnalyzer.resultComparer;

public class Message implements Comparable {

	private int graphId;
	private Integer toGraphId;
	
	public Message(int graphId, Integer toGraphId) {
		this.graphId = graphId;
		this.toGraphId = toGraphId;
	}
	
	public int getGraphId() {
		return this.graphId;
	}
	
	public Integer getToGraphId() {
		return this.toGraphId;
	}
	
	public String toString() {
		if (this.toGraphId == null)
			return "graph "+this.graphId+": not found";
		else
			return "graph "+this.graphId+": found as "+this.toGraphId;
	}
	
	public boolean equals(Object o) {
		Message m = (Message) o;
		if (m.getGraphId() == this.graphId && m.getToGraphId() == this.toGraphId)
			return true;
		return false;
	}
	
	public int hashSet() {
		return new Integer(this.graphId).hashCode() + new Integer(this.toGraphId).hashCode();
	}
	
	public int compareTo(Object o) {
		Message m = (Message) o;
		if (m.graphId < this.graphId)
			return 1;
		else if (m.graphId > this.graphId)
			return -1;
		return 0;
	}
}
